<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>奥鹏网考系统 - 刷身份证测试界面</title>
    <link rel="shortcut icon" href="favicon.ico" mce_href="/favicon.ico" type="image/x-icon" />

    <link href="//openexamcdn.open.com.cn/openexam/static/Content/bootstrap.min.css" rel="stylesheet" />
</head>
<div class="container">
    <object id="obj" classid="clsid:{8B72535D-5905-43C4-A6E2-ED5ACD6EFA72}" codebase="setup.exe#version=1,00,0000" class="hide"></object>

    <div class="page-header">
        <h1>
            刷身份证测试 <small>请将机具连接电脑</small>
        </h1>

        <button id="btnRead" class="btn btn-primary">
            <i class="glyphicon glyphicon-credit-card"></i>
            读卡
        </button>
    </div>

    <div class="well">
        <div class="row">
            <div class="col-sm-6">
                <dl class="dl-horizontal">
                    <dt>姓名：</dt>
                    <dd id="txtName"></dd>
                </dl>

                <dl class="dl-horizontal">
                    <dt>性别：</dt>
                    <dd id="txtGender"></dd>
                </dl>

                <dl class="dl-horizontal">
                    <dt>民族：</dt>
                    <dd id="txtFolk"></dd>
                </dl>

                <dl class="dl-horizontal">
                    <dt>出生日期：</dt>
                    <dd id="txtBirthDay"></dd>
                </dl>

                <dl class="dl-horizontal">
                    <dt>证件号码：</dt>
                    <dd id="txtCode"></dd>
                </dl>

                <dl class="dl-horizontal">
                    <dt>地址：</dt>
                    <dd id="txtAddress"></dd>
                </dl>

                <dl class="dl-horizontal">
                    <dt>签发机关：</dt>
                    <dd id="txtAgency"></dd>
                </dl>

                <dl class="dl-horizontal">
                    <dt>签发时间：</dt>
                    <dd id="txtExpireStart"></dd>
                </dl>

                <dl class="dl-horizontal">
                    <dt>有效日期：</dt>
                    <dd id="txtExpireEnd"></dd>
                </dl>
            </div>
        </div>
    </div>
</div>

<script src="//openexamcdn.open.com.cn/openexam/static/Scripts/jquery-1.12.4.min.js"></script>
<script>
    $(function () {
        var br = navigator.userAgent.toLowerCase();
        var isIe = br.indexOf('trident') > -1 || br.indexOf('msie') > -1 > -1;
        if (!isIe)
            alert('请使用IE浏览器进行刷卡操作！\n请注意Edge浏览器并不是IE的浏览器！');

        $('#btnRead').click(function () {
            try {
                var obj = document.getElementById('obj');
                if (obj.IsAuthenticate()) {
                    var stuInfo = JSON.parse(obj.ReadBaseInfos());

                    $('#txtName').html(stuInfo.Name);
                    $('#txtGender').html(stuInfo.Gender);
                    $('#txtFolk').html(stuInfo.Folk);
                    $('#txtBirthDay').html(stuInfo.BirthDay);
                    $('#txtCode').html(stuInfo.Code);
                    $('#txtAddress').html(stuInfo.Address);
                    $('#txtAgency').html(stuInfo.Agency);
                    $('#txtExpireStart').html(stuInfo.ExpireStart);
                    $('#txtExpireEnd').html(stuInfo.ExpireEnd);
                } else {
                    alert('请将身份证放到机具上！');
                }
            }
            catch (e) {
                alert('不能检测到可用机具，请确认机具驱动和浏览器ActiveX插件是否正确安装。');
            }
        });
    })
</script>
</body>
</html>